package com.woniuxy.handler;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.woniuxy.pojo.Guest;
import com.woniuxy.pojo.Guest_yyh;
import com.woniuxy.service.GuestService;

@Controller
@RequestMapping("/guest")
@RestController
public class GuestHandler {
	@Resource
	private GuestService guestService;
	
	//添加住客信息
	@RequestMapping("/add")
	@ResponseBody
	public void aaa(String title,String phone,String identity,String sex){
		//登录时存一个账号的session，将uid取出
		int uid=1;
		//System.out.println(title+"----------"+identity);
		Guest guest = new Guest();
		guest.setGname(title);
		guest.setGidcard(identity);
		guest.setUid(uid);
		String s=guestService.addGuest(guest);
		System.out.println(s);
	}
	
	//显示所有入住宾客
	@RequestMapping("/all")
	public List<Guest_yyh> getAll(){
		return guestService.getCheckinG();
	}
	
	//搜索入住宾客
	@RequestMapping("/sel")
	public List<Guest_yyh> selG(String message){
		return guestService.selG(message);
	}
}
